<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <title>求职者信息管理</title>
    <link href="/js/bstable/css/bootstrap.min.css" rel="stylesheet" type="text/css">
    <link href="/js/bstable/css/bootstrap-table.css" rel="stylesheet" type="text/css">
    <link href="/css/table.css" rel="stylesheet" type="text/css">

    <script src="/js/vue.js"></script>
    <script src="/js/axios.min.js"></script>
</head>
<body style="background-color: #ecf0f5;font-family: 微软雅黑;color: #475059;min-width: 1000px;overflow: auto">
<div id="app">
<!--    <div  class="notice_main">-->
<!--        <table id="table" class="table_style" style="margin: 0 auto" > </table>-->
<!--    </div>-->
    <script src="/js/jquery/jQuery-2.2.0.min.js"></script>
    <script src="/js/bstable/js/bootstrap.min.js"></script>
    <script src="/js/bstable/js/bootstrap-table.js"></script>
    <script src="/js/bstable/js/bootstrap-table-zh-CN.min.js"></script>
    <script src="/js/layer_v2.1/layer/layer.js"></script>

    <table class="table table-bordered  table-hover">
        <div class="notice_check">
            <div class="btn-group l_left" style="margin-right: 4px">
                <select v-model="state_id" class="form-control" name="state_id">
                    <option value="0">---请选择---</option>
                    <option v-for="select in state"  v-bind:value="select.state_id" >
                        {{select.state}}
                    </option>
                </select>
            </div>
            <div class="l_left">
                <input type="text"  v-model="name" name="companyName" class="form-control" placeholder="请输入公司名称">
            </div>
            <button type="button" @click="queryCom" class="btn btn-primary">查询</button>

<!--            <div class="notice_nav r_right">-->
<!--                <a class="btn btn-default" onclick="addRole()"><span class="glyphicon glyphicon-plus"></span>新增</a>-->
<!--                <a class="btn btn-default"><span class="glyphicon glyphicon-remove"></span>删除</a>-->
<!--                <a class="btn btn-default" onclick="addRole()"><span class="glyphicon glyphicon-pencil"></span>编辑</a>-->
<!--            </div>-->
        </div>
        <tr>
            <th type="radio">▢</th>
            <th>编号</th>
<!--            <th>公司ID</th>-->
            <th>公司全称</th>
            <th>公司账号</th>
            <th>公司密码</th>
            <th>公司图片</th>
            <th>公司电话</th>
            <th>公司邮箱</th>
<!--            <th>职位ID</th>-->
<!--            <th>工作时间</th>-->
            <th>公司地址</th>
            <th>工作地点</th>
            <th>注册日期</th>
            <th>创建日期</th>
            <th>是否需要融资</th>
            <th>法定代表人</th>
            <th>状态</th>
            <th>操作</th>
        </tr>
        <tr v-for="(item,index) in companyList">
            <td><label>
                <input type="checkbox"   id="inlinecheckbox1" value="true">
            </label></td>
            <td> {{index+1}} </td>
<!--            <td>{{item.company_id}}</td>-->
            <td>{{item.company_name}}</td>
            <td>{{item.company_number}}</td>
            <td>{{item.company_pass}}</td>
            <td>{{item.company_img_url}}</td>
            <td>{{item.company_tel}}</td>
            <td>{{item.company_email}}</td>
<!--            <td>{{item.job_id}}</td>-->
<!--            <td>{{company_time}}</td>-->
            <td>{{item.company_add}}</td>
            <td>{{item.job_add}}</td>
            <td>{{item.company_date}}</td>
            <td>{{item.create_date}}</td>
            <td>{{item.financing}}</td>
            <td>{{item.legal_person}}</td>
            <td>{{item.company_state}}</td>
            <td> <a    @click="updateCom1(item.company_id)">通过</a> |  <a    @click="updateCom(item.company_id)">驳回</a> |  <a    @click="LookCom(item.company_id)">详情</a></td>
        </tr>
    </table>
<!--    <nav aria-label="Page navigation">-->
<!--        <ul class="pagination">-->
<!--            <li @click="getPreviousPageData(pageInfo.pageNum)">-->
<!--                <a href="#" aria-label="Previous">-->
<!--                    <span aria-hidden="true">&laquo;</span>-->
<!--                </a>-->
<!--            </li>-->
<!--            <li :class="pageInfo.pageNum==num?'active':''" @click="getPageData(num)" v-for="num in pageInfo.navigatepageNums">-->
<!--                <a>{{num}}</a>-->
<!--            </li>-->
<!--            <li @click="getNextPageData(pageInfo.pageNum)">-->
<!--                <a href="#" aria-label="Next">-->
<!--                    <span aria-hidden="true">&raquo;</span>-->
<!--                </a>-->
<!--            </li>-->
<!--        </ul>-->
<!--    </nav>-->
</div>
</body>
</html>
<script>
    new Vue({
        el:"#app",
        data:{
            name:'',
            state_id:0,
            state:[],
            companyList:[],
            // pageInfo:[]        //返回了PageInfo对象，包含了分页信息
        },
        methods:{
            queryCom:function (){
                _this = this
                //查询学生信息
                axios.get('/company/list',{
                    params: {
                        companyName: this.name,
                        state_id:this.state_id
                    }
                }).then(function (response) {
                    _this.companyList=response.data.object;
                    console.log(response.data);
                })
                    .catch(function (error) {
                        console.log(error);
                    });
            },
            updateCom:function (company_id){
                alert("审核未通过")
                window.localStorage.setItem("sid", company_id);
                location.href="company.html"
                axios.get('/company/update',{
                    params:{
                        company_id:company_id
                    }
                }).then(function (response){
                    console.log(response.data);
                })
                    .catch(function(error){
                        console.log(error)
                    });

            },
            updateCom1:function (company_id) {
                alert("审核通过")
                window.localStorage.setItem("sid", company_id);
                location.href = "company.html"
                axios.get('/company/update1', {
                    params: {
                        company_id: company_id
                    }
                }).then(function (response) {
                    console.log(response.data);
                })
                    .catch(function (error) {
                        console.log(error)
                    });
            },
            LookCom:function (company_id){
                //alert(stuid)
                window.localStorage.setItem("company_id",company_id);
                location.href="lookCompany.html"
            },
            // getPreviousPageData:function(num){
            //     num--;
            //     if(num<1){
            //         return;
            //     }
            //     this.getPageData(num)
            // },
            // getNextPageData:function(num){
            //     num++;
            //     if(num>this.pageInfo.pages){
            //         return;
            //     }
            //     this.getPageData(num)
            // },
            // getPageData:function (num){
            //     _this = this
            //     axios.get('/company/list3/'+num,{
            //         params: {
            //             companyName: this.name,
            //
            //         }
            //     }).then(function (response){
            //         console.log(response.data);
            //         _this.pageInfo=response.data.object;
            //
            //     })
            //         .catch(function (error){
            //             console.log(error);
            //         });
            // }

        },

        mounted() {

            // this.getPageData(1)
            //
            // _this = this
            // axios.get('/company/list3',{
            //     params: {
            //         companyName: this.name,
            //
            //     }
            // }).then(function (response){
            //     console.log(response.data);
            //     _this.companyList=response.data;
            //
            // })
            //     .catch(function (error){
            //         console.log(error);
            //     });

            _this = this
            //查询学生信息
            axios.get('/company/list',{
                params: {
                    companyName: this.name,
                    state_id:this.state_id
                }
            }).then(function (response) {
                _this.companyList=response.data;
                console.log(response.data);
            })
                .catch(function (error) {
                    console.log(error);
                });

            //查询状态信息
            axios.get('/state/list')
                .then(function (response) {
                    _this.state = response.data
                    console.log(_this.state);
                })
                .catch(function (error) {
                    console.log(error);
                });

            // axios.get('/com/update1', {
            //     params: {
            //         company_id:company_id
            //     }
            // }).then(function (response) {
            //     console.log(response.data);
            // })
            //     .catch(function (error) {
            //         console.log(error)
            //     });
        }
    })
</script>